#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    void merge(vector<int>& nums1, int m, vector<int>& nums2, int n)
    {
        int index1 = 0;
        for (int i = 0; i < n; i++) {
            while (nums2[i] >= nums1[index1] && index1 < m + i)
                index1++;
            for (int j = m + i; j > index1; j--)
                nums1[j] = nums1[j - 1];
            nums1[index1++] = nums2[i];
        }
    }
};

int main(int argc, char const* argv[])
{
    Solution temp;
    int a[6] = { 1, 2, 3, 0, 0, 0 };
    vector<int> nums1(a, a + 6);
    int b[3] = { 2, 5, 6 };
    vector<int> nums2(b, b + 3);
    temp.merge(nums1, 3, nums2, 3);
    return 0;
}